package pe.edu.unmsm.fisi.sysllabus.presentacion.controller.procesos;

import java.io.Serializable;

import org.primefaces.component.chart.series.ChartSeries;
import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.PieChartModel;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
@Scope("session")
public class ChartBean implements Serializable {  
	  
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private CartesianChartModel cartesianModel;  
  
    private PieChartModel pieModel;  
    
    public String iraReportes(){
    	return "rep";
    }
  
    public ChartBean() {  
        createCartesianModel();  
        createPieModel();  
    }  
  
    public CartesianChartModel getCartesianModel() {  
        return cartesianModel;  
    }  
  
    public PieChartModel getPieModel() {  
        return pieModel;  
    }  
  
    private void createCartesianModel() {  
        cartesianModel = new CartesianChartModel();  
  
        ChartSeries boys = new ChartSeries();  
        boys.setLabel("Ingenieria de Software");  
  
        boys.set("Sem. 1", 25);  
        boys.set("Sem. 2", 21);  
        boys.set("Sem. 3", 10);  
        boys.set("Sem. 4", 12);  
        boys.set("Sem. 5", 26);  
  
        ChartSeries girls = new ChartSeries();  
        girls.setLabel("Ingenieria de Sistemas");  
  
        girls.set("Sem. 1", 15);  
        girls.set("Sem. 2", 23);  
        girls.set("Sem. 3", 9);  
        girls.set("Sem. 4", 11);  
        girls.set("Sem. 5", 28);  
  
        cartesianModel.addSeries(boys);  
        cartesianModel.addSeries(girls);  
    }  
  
    private void createPieModel() {  
        pieModel = new PieChartModel();  
  
        pieModel.set("Brand 1", 540);  
        pieModel.set("Brand 2", 325);  
        pieModel.set("Brand 3", 702);  
        pieModel.set("Brand 4", 421);  
    }  
}  